package cn.wzvtcsoft.base;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

/**
 * @author swxu_2005@163.com
 * @date 2018/10/7
 */
@Getter
@Setter
@EntityListeners(AuditingEntityListener.class)
@MappedSuperclass
@JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler", "fieldHandler"})
public abstract class BaseEntity extends BaseCoreObject implements IEntity {

  private String number;

  @CreatedBy
  @JsonIgnore
  private Long creatorId;

  @LastModifiedBy
  @JsonIgnore
  private Long updaterId;

  @CreatedDate
  @JsonIgnore
  private Long gmtCreate;

  @LastModifiedDate
  @JsonIgnore
  private Long gmtModified;

  @JsonIgnore
  @Column(name = "is_deleted")
  private Boolean deleted = false;
}
